Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Screen Dimming #651

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Screen Dimming #651

wants to merge 2 commits into from

Conversation

fossfreedom
Copy link
Contributor

@fossfreedom fossfreedom commented Jan 5, 2025

Description

This PR adds power-dimming support if configured in BCC Power.

Also added on Evan's request, the ability to style gtklock via the gtklock config & style files if they exist in their home config/budgie-desktop folder.

i.e. if idle-dim is configured then swayidle will dim after 30 seconds and resume with the original set brightness.
It uses gsd-power to configure brightness settings.

Marking as draft until the screenlock PR is dealt with and then this will need rebasing.

Submitter Checklist

  • Squashed commits with git rebase -i (if needed)
  • Built budgie-desktop and verified that the patch worked (if needed)

Copy link
Member

@EbonJaeger EbonJaeger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an interesting mix of spaces and tabs used for indentation in the screenlock.vala file, in some cases, both on the same line.

src/daemon/screenlock.vala Outdated Show resolved Hide resolved
Comment on lines 127 to 146
if (sleep_inactive_battery_type == "suspend" && sleep_inactive_battery_timeout != 0) {
output = "timeout " + sleep_inactive_battery_timeout.to_string();
output += " 'if dbus-send --print-reply=literal --dest=org.buddiesofbudgie.BudgieScreenlock /org/buddiesofbudgie/Screenlock org.buddiesofbudgie.BudgieScreenlock.OnBattery | grep \"boolean true\" > /dev/null; then systemctl suspend; fi' ";
}

if (sleep_inactive_ac_type == "suspend" && sleep_inactive_ac_timeout !=0) {
output += " timeout " + sleep_inactive_ac_timeout.to_string();
output += " 'if dbus-send --print-reply=literal --dest=org.buddiesofbudgie.BudgieScreenlock /org/buddiesofbudgie/Screenlock org.buddiesofbudgie.BudgieScreenlock.OnBattery | grep \"boolean false\" > /dev/null; then systemctl suspend; fi' ";
}

return output;
}

private string calculate_dim() {
isdimmable = this.power.get_boolean("idle-dim");

if (!isdimmable) return "";

return "timeout 30 'dbus-send --type=method_call --dest=org.buddiesofbudgie.BudgieScreenlock /org/buddiesofbudgie/Screenlock org.buddiesofbudgie.BudgieScreenlock.Dim' resume 'dbus-send --type=method_call --dest=org.buddiesofbudgie.BudgieScreenlock /org/buddiesofbudgie/Screenlock org.buddiesofbudgie.BudgieScreenlock.Undim' ";
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do this when we have the methods available to us right in this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'fraid I don't understand the comment. Here we are adding a timeout/resume to swayidle to perform the dim/undim stuff if its set in BCC to screendim

src/daemon/screenlock.vala Outdated Show resolved Hide resolved
src/daemon/screenlock.vala Outdated Show resolved Hide resolved
@fossfreedom
Copy link
Contributor Author

There is an interesting mix of spaces and tabs used for indentation in the screenlock.vala file, in some cases, both on the same line.

That was resolved via the original screenlock PR - now merged.

@fossfreedom fossfreedom marked this pull request as ready for review January 12, 2025 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants